home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / c80tcog.lbr / RANDI1.C < prev    next >
Text File  |  1985-08-09  |  768b  |  28 lines

  1. /*    randi1 - pseudo-random integer routine            */
  2. /*
  3.     McCracken, Daniel D. "A Guide to PL/M Programming for
  4.     Microcomputer Applications", Addison-Wesley, Reading, Mass.,
  5.     1978, p. 113.
  6.  
  7.     This routine generates a full cycle of unsigned 16-bit
  8. pseudo-random numbers using the multiplicative congruential method.
  9. It assumes that type unsigned is implemented as 16 bit binary numbers.
  10.  
  11.     Converted to C by
  12.  
  13.     William G. Hutchison, Jr.
  14.     P.O. Box 278
  15.     Exton, PA 19341-0278
  16.     U.S.A.
  17.  
  18.     CompuServe 70665,1307
  19.     Englewood, CO CNODE #1080
  20.  
  21.  */
  22.  
  23. randi1(p)            /* 16 bit random integer    */
  24. unsigned *p            /* previous value        */;
  25. {
  26. return    (*p= 2053 * *p + 13849);
  27. }                /* end of randi1        */
  28.